//
//  CWFData.h
//  Care Wit Friends - DataView
//
//  Created by Kleinfelder, Erik on 11/3/13.
//  Copyright (c) 2013 Kleinfelder, Erik. All rights reserved.
//

#import <Foundation/Foundation.h>

#define BASEURLREQUEST    "authenticate"

@interface CWFData : NSObject {
    NSInteger CWFUserID;
    NSString *CWFpasswd;
    NSString *CWFAuthtoken;
    NSString *currentRequest;
    NSString *CWFBaseURL;
    NSString *CWFUserQuery;
    NSMutableData *_responseData;
    NSMutableArray *CWFUserDetailArray;
    NSMutableArray *CWFUserFollowers;
    NSMutableArray *CWFUserFollowedUsers;
    NSMutableDictionary *CWFAuthDict;
    NSMutableArray *CWFUserFeedArray;
    NSMutableArray *CWFFollowingFeedArray;
    NSMutableArray *CWFInterestedFeedArray;
    NSMutableArray *CWFGlobalFeedArray;
    NSMutableArray *CWFGlobalLeaderboardArray;
    NSMutableArray *CWFFriendsLeaderboardArray;
    NSMutableArray *CWFGetProblemArray;
    NSMutableArray *CWFPostFollowUser;
    NSMutableArray *CWFPostCreateProblem;
    NSMutableArray *CWFGetSaleArray;
    NSMutableArray *CWFGetTagListArray;
    NSMutableArray *CWFGetUsersListArray;
    
    
    
    NSMutableArray *commandQueue;
    NSTimer *heartBeatTimer;
}

+ (CWFData *)sharedInstance;

- (int) connectWithUserPass:(NSString *)aUser emailAddr:(NSString *)aEmail password:(NSString *)aPass;
- (int) sendCWFGetRequest:(NSString *)CWFRequestString;
- (int) sendCWFPostRequest:(NSString *)CWFPostString requestDict:(NSDictionary *)CWFPostRequestDict;

- (void) refreshAllData;
- (int) authStatus;
- (void) CWFLogout;

// GET Methods
- (NSMutableArray *)getUserDetail;
- (NSMutableArray *)getUserFollowers;
- (NSMutableArray *)getFollowedUsers;
- (NSMutableArray *)getUserFeed;
- (NSMutableArray *)getFollowingFeed;
- (NSMutableArray *)getInterestedFeed;
- (NSMutableArray *)getGlobalFeed;
- (NSMutableArray *)getGlobalLeaderboard;
- (NSMutableArray *)getFriendsLeaderboard;
- (NSMutableArray *)getProblem;
- (NSMutableArray *)getSale;
- (NSMutableArray *)getTagList;
- (NSMutableArray *)getUsersList;

// POST Methods
- (void) followUser:(NSString *)userToFollow;
- (void) unfollowUser:(NSString *)userToUnfollow;
- (void) addInterest:(NSString *)interest;
- (void) removeInterest:(NSString *)interest;
- (void) createProblem:(NSString *)customerName
         customerPhone:(NSString *)customerTN
             custEmail:(NSString *)customerEmail
       custMobilePhone:(NSString *)customerMobileTN
                 title:(NSString *)problemTitle
           description:(NSString *)problemDescription
                  tags:(NSMutableArray *)problemTags;
- (void) addTagToProblem:(NSString *)tag;
- (void) removeTagFromProblem:(NSString *)tag;
- (void) createSale:(NSString *)customerName
      customerPhone:(NSString *)customerTN
          custEmail:(NSString *)customerEmail
    custMobilePhone:(NSString *)customerMobileTN
        description:(NSString *)problemDescription;
- (void) createPost:(NSString *)postBody postIssueNum:(NSString *)postID postType:(NSString *)postSaleOrProblemType;
- (void) createComment:(NSString *)postBody postIssueNum:(NSString *)postID;


@property (readwrite, nonatomic) NSInteger CWFUserID;
@property (readwrite, nonatomic) NSString *CWFAuthtoken;
@property (readwrite,nonatomic) NSString *CWFlogin;
@property (readwrite,nonatomic) NSString *CWFpassword;
@property (readwrite,nonatomic) NSString *CWFemail;
@property (readwrite,nonatomic) NSString *currentRequest;

@end
